
//
//  DsCellCell.m
//  Tour
//
//  Created by 张张烨 on 16/3/10.
//  Copyright © 2016年 张中烨. All rights reserved.
//

#import "DsCellCell.h"
#import "PrefixHeader.pch"
#import "DsCellDateModelsi.h"
#import "DsCellDateModelsan.h"
#define kCellWidth self.contentView.frame.size.width
#define kCellHeight self.contentView.frame.size.height

@interface DsCellCell ()
@property (nonatomic,retain)UILabel *descriptionFL;
@property (nonatomic,retain)UIView *separatorView;
@property (nonatomic,retain)SiteView *siteView;
@property (nonatomic,retain)ClickImageView *photo;
@end
@implementation DsCellCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self.contentView setBackgroundColor:[UIColor colorWithRed:0.8824 green:0.9059 blue:0.9333 alpha:1.0]];
       
        
        self.descriptionFL = [[UILabel alloc]init];
        [self.descriptionFL setNumberOfLines:0];
        [self.descriptionFL setFont:[UIFont systemFontOfSize:15]];
        [self.contentView addSubview:self.descriptionFL];
      
        self.siteView = [[SiteView alloc]init];
        [self.contentView addSubview:self.siteView];
        
        self.photo = [[ClickImageView alloc]init];
        [self.photo setContentMode:UIViewContentModeScaleToFill];
        [self.contentView addSubview:self.photo];
       
        
        self.separatorView = [[UIView alloc]init];
        [self.separatorView setBackgroundColor:[UIColor blackColor]];
        [self.contentView addSubview:self.separatorView];
//        [self.contentView NightWithType:UIViewColorTypeNormal];
        
    }
    return self;
}

+ (DsCellCell *)travel_Detail_CellTwoWithTableView:(UITableView *)tableView{
    DsCellCell *cellTwo = [tableView dequeueReusableCellWithIdentifier:@"detail_Cell_Two"];
    if (!cellTwo) {
        cellTwo = [[DsCellCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"detail_Cell_Two"];
    }
    return cellTwo;
}
- (void)setCellContent:(DsCellDateModelsan *)cellContent{
  
        
        _cellContent = cellContent;
    
    [self.descriptionFL setText:self.cellContent.descriptionF];
    [self.descriptionFL setText:self.cellContent.descriptionF];
//    [self.descriptionFL NightWithType:UIViewColorTypeNormal];
    [self.photo setBackgroundColor:[UIColor whiteColor]];
    [self.photo sd_setImageWithURL:[NSURL URLWithString:self.cellContent.photos.url] placeholderImage:[UIImage imageNamed:@"placeHolder"]];
    
}


- (void)layoutSubviews{
    [super layoutSubviews];
    CGFloat labelHeight = [LCAFNetWorking AutoSizeOfHeightWithText:self.cellContent.descriptionF andFont:[UIFont systemFontOfSize:15] andLabelWidth:kCellWidth - 20];
    CGFloat photoHeight = [self.cellContent.photos.image_height floatValue] / [self.cellContent.photos.image_width floatValue] * (kCellWidth - 20);
    [self.siteView setFrame:CGRectMake(0, 0, kCellWidth, 60)];
    [self.photo setFrame:CGRectMake(10, 10 + self.siteView.frame.size.height + self.siteView.frame.origin.y, kCellWidth - 20, photoHeight)];
    [self.descriptionFL setFrame:CGRectMake(10, 10 + self.photo.frame.size.height + self.photo.frame.origin.y, kCellWidth - 20, labelHeight)];
    [self.separatorView setFrame:CGRectMake(10, kCellHeight - 0.35, kCellWidth - 20, 0.7)];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
